{"ast":null,"code":"import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport toNodeArray from \"rc-util/es/Children/toArray\";\nimport warning, { noteOnce } from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport { isMultiple } from \"../BaseSelect\";\nimport { toArray } from \"./commonUtil\";\nimport { convertChildrenToData } from \"./legacyUtil\";\nfunction warningProps(props) {\n  var mode = props.mode,\n    options = props.options,\n    children = props.children,\n    backfill = props.backfill,\n    allowClear = props.allowClear,\n    placeholder = props.placeholder,\n    getInputElement = props.getInputElement,\n    showSearch = props.showSearch,\n    onSearch = props.onSearch,\n    defaultOpen = props.defaultOpen,\n    autoFocus = props.autoFocus,\n    labelInValue = props.labelInValue,\n    value = props.value,\n    inputValue = props.inputValue,\n    optionLabelProp = props.optionLabelProp;\n  var multiple = isMultiple(mode);\n  var mergedShowSearch = showSearch !== undefined ? showSearch : multiple || mode === 'combobox';\n  var mergedOptions = options || convertChildrenToData(children); // `tags` should not set option as disabled\n\n  warning(mode !== 'tags' || mergedOptions.every(function (opt) {\n    return !opt.disabled;\n  }), 'Please avoid setting option to disabled in tags mode since user can always type text as tag.'); // `combobox` & `tags` should option be `string` type\n\n  if (mode === 'tags' || mode === 'combobox') {\n    var hasNumberValue = mergedOptions.some(function (item) {\n      if (item.options) {\n        return item.options.some(function (opt) {\n          return typeof ('value' in opt ? opt.value : opt.key) === 'number';\n        });\n      }\n      return typeof ('value' in item ? item.value : item.key) === 'number';\n    });\n    warning(!hasNumberValue, '`value` of Option should not use number type when `mode` is `tags` or `combobox`.');\n  } // `combobox` should not use `optionLabelProp`\n\n  warning(mode !== 'combobox' || !optionLabelProp, '`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly.'); // Only `combobox` support `backfill`\n\n  warning(mode === 'combobox' || !backfill, '`backfill` only works with `combobox` mode.'); // Only `combobox` support `getInputElement`\n\n  warning(mode === 'combobox' || !getInputElement, '`getInputElement` only work with `combobox` mode.'); // Customize `getInputElement` should not use `allowClear` & `placeholder`\n\n  noteOnce(mode !== 'combobox' || !getInputElement || !allowClear || !placeholder, 'Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`.'); // `onSearch` should use in `combobox` or `showSearch`\n\n  if (onSearch && !mergedShowSearch && mode !== 'combobox' && mode !== 'tags') {\n    warning(false, '`onSearch` should work with `showSearch` instead of use alone.');\n  }\n  noteOnce(!defaultOpen || autoFocus, '`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed.');\n  if (value !== undefined && value !== null) {\n    var values = toArray(value);\n    warning(!labelInValue || values.every(function (val) {\n      return _typeof(val) === 'object' && ('key' in val || 'value' in val);\n    }), '`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`');\n    warning(!multiple || Array.isArray(value), '`value` should be array when `mode` is `multiple` or `tags`');\n  } // Syntactic sugar should use correct children type\n\n  if (children) {\n    var invalidateChildType = null;\n    toNodeArray(children).some(function (node) {\n      if (! /*#__PURE__*/React.isValidElement(node) || !node.type) {\n        return false;\n      }\n      var _ref = node,\n        type = _ref.type;\n      if (type.isSelectOption) {\n        return false;\n      }\n      if (type.isSelectOptGroup) {\n        var allChildrenValid = toNodeArray(node.props.children).every(function (subNode) {\n          if (! /*#__PURE__*/React.isValidElement(subNode) || !node.type || subNode.type.isSelectOption) {\n            return true;\n          }\n          invalidateChildType = subNode.type;\n          return false;\n        });\n        if (allChildrenValid) {\n          return false;\n        }\n        return true;\n      }\n      invalidateChildType = type;\n      return true;\n    });\n    if (invalidateChildType) {\n      warning(false, \"`children` should be `Select.Option` or `Select.OptGroup` instead of `\".concat(invalidateChildType.displayName || invalidateChildType.name || invalidateChildType, \"`.\"));\n    }\n    warning(inputValue === undefined, '`inputValue` is deprecated, please use `searchValue` instead.');\n  }\n} // value in Select option should not be null\n// note: OptGroup has options too\n\nexport function warningNullOptions(options, fieldNames) {\n  if (options) {\n    var recursiveOptions = function recursiveOptions(optionsList) {\n      var inGroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n      for (var i = 0; i < optionsList.length; i++) {\n        var option = optionsList[i];\n        if (option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value] === null) {\n          warning(false, '`value` in Select options should not be `null`.');\n          return true;\n        }\n        if (!inGroup && Array.isArray(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.options]) && recursiveOptions(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.options], true)) {\n          break;\n        }\n      }\n    };\n    recursiveOptions(options);\n  }\n}\nexport default warningProps;","map":{"version":3,"names":["_typeof","toNodeArray","warning","noteOnce","React","isMultiple","toArray","convertChildrenToData","warningProps","props","mode","options","children","backfill","allowClear","placeholder","getInputElement","showSearch","onSearch","defaultOpen","autoFocus","labelInValue","value","inputValue","optionLabelProp","multiple","mergedShowSearch","undefined","mergedOptions","every","opt","disabled","hasNumberValue","some","item","key","values","val","Array","isArray","invalidateChildType","node","isValidElement","type","_ref","isSelectOption","isSelectOptGroup","allChildrenValid","subNode","concat","displayName","name","warningNullOptions","fieldNames","recursiveOptions","optionsList","inGroup","arguments","length","i","option"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-select/es/utils/warningPropsUtil.js"],"sourcesContent":["import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport toNodeArray from \"rc-util/es/Children/toArray\";\nimport warning, { noteOnce } from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport { isMultiple } from \"../BaseSelect\";\nimport { toArray } from \"./commonUtil\";\nimport { convertChildrenToData } from \"./legacyUtil\";\n\nfunction warningProps(props) {\n  var mode = props.mode,\n      options = props.options,\n      children = props.children,\n      backfill = props.backfill,\n      allowClear = props.allowClear,\n      placeholder = props.placeholder,\n      getInputElement = props.getInputElement,\n      showSearch = props.showSearch,\n      onSearch = props.onSearch,\n      defaultOpen = props.defaultOpen,\n      autoFocus = props.autoFocus,\n      labelInValue = props.labelInValue,\n      value = props.value,\n      inputValue = props.inputValue,\n      optionLabelProp = props.optionLabelProp;\n  var multiple = isMultiple(mode);\n  var mergedShowSearch = showSearch !== undefined ? showSearch : multiple || mode === 'combobox';\n  var mergedOptions = options || convertChildrenToData(children); // `tags` should not set option as disabled\n\n  warning(mode !== 'tags' || mergedOptions.every(function (opt) {\n    return !opt.disabled;\n  }), 'Please avoid setting option to disabled in tags mode since user can always type text as tag.'); // `combobox` & `tags` should option be `string` type\n\n  if (mode === 'tags' || mode === 'combobox') {\n    var hasNumberValue = mergedOptions.some(function (item) {\n      if (item.options) {\n        return item.options.some(function (opt) {\n          return typeof ('value' in opt ? opt.value : opt.key) === 'number';\n        });\n      }\n\n      return typeof ('value' in item ? item.value : item.key) === 'number';\n    });\n    warning(!hasNumberValue, '`value` of Option should not use number type when `mode` is `tags` or `combobox`.');\n  } // `combobox` should not use `optionLabelProp`\n\n\n  warning(mode !== 'combobox' || !optionLabelProp, '`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly.'); // Only `combobox` support `backfill`\n\n  warning(mode === 'combobox' || !backfill, '`backfill` only works with `combobox` mode.'); // Only `combobox` support `getInputElement`\n\n  warning(mode === 'combobox' || !getInputElement, '`getInputElement` only work with `combobox` mode.'); // Customize `getInputElement` should not use `allowClear` & `placeholder`\n\n  noteOnce(mode !== 'combobox' || !getInputElement || !allowClear || !placeholder, 'Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`.'); // `onSearch` should use in `combobox` or `showSearch`\n\n  if (onSearch && !mergedShowSearch && mode !== 'combobox' && mode !== 'tags') {\n    warning(false, '`onSearch` should work with `showSearch` instead of use alone.');\n  }\n\n  noteOnce(!defaultOpen || autoFocus, '`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed.');\n\n  if (value !== undefined && value !== null) {\n    var values = toArray(value);\n    warning(!labelInValue || values.every(function (val) {\n      return _typeof(val) === 'object' && ('key' in val || 'value' in val);\n    }), '`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`');\n    warning(!multiple || Array.isArray(value), '`value` should be array when `mode` is `multiple` or `tags`');\n  } // Syntactic sugar should use correct children type\n\n\n  if (children) {\n    var invalidateChildType = null;\n    toNodeArray(children).some(function (node) {\n      if (! /*#__PURE__*/React.isValidElement(node) || !node.type) {\n        return false;\n      }\n\n      var _ref = node,\n          type = _ref.type;\n\n      if (type.isSelectOption) {\n        return false;\n      }\n\n      if (type.isSelectOptGroup) {\n        var allChildrenValid = toNodeArray(node.props.children).every(function (subNode) {\n          if (! /*#__PURE__*/React.isValidElement(subNode) || !node.type || subNode.type.isSelectOption) {\n            return true;\n          }\n\n          invalidateChildType = subNode.type;\n          return false;\n        });\n\n        if (allChildrenValid) {\n          return false;\n        }\n\n        return true;\n      }\n\n      invalidateChildType = type;\n      return true;\n    });\n\n    if (invalidateChildType) {\n      warning(false, \"`children` should be `Select.Option` or `Select.OptGroup` instead of `\".concat(invalidateChildType.displayName || invalidateChildType.name || invalidateChildType, \"`.\"));\n    }\n\n    warning(inputValue === undefined, '`inputValue` is deprecated, please use `searchValue` instead.');\n  }\n} // value in Select option should not be null\n// note: OptGroup has options too\n\n\nexport function warningNullOptions(options, fieldNames) {\n  if (options) {\n    var recursiveOptions = function recursiveOptions(optionsList) {\n      var inGroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n      for (var i = 0; i < optionsList.length; i++) {\n        var option = optionsList[i];\n\n        if (option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value] === null) {\n          warning(false, '`value` in Select options should not be `null`.');\n          return true;\n        }\n\n        if (!inGroup && Array.isArray(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.options]) && recursiveOptions(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.options], true)) {\n          break;\n        }\n      }\n    };\n\n    recursiveOptions(options);\n  }\n}\nexport default warningProps;"],"mappings":"AAAA,OAAOA,OAAO,MAAM,mCAAmC;AACvD,OAAOC,WAAW,MAAM,6BAA6B;AACrD,OA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